package org.bbs.demo.reply.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.bbs.demo.reply.dto.ReplyShowDto;
import org.bbs.demo.reply.dto.StoreyReplyShowDto;

import java.util.ArrayList;

@Mapper
public interface ShowDao {
    @Select("select * from bbsreply where topic_id = #{topic_id} order by r_likes desc")
    public ArrayList<ReplyShowDto>ShowReplyLike(String topic_id);

    @Select("select * from bbsreply where topic_id = #{topic_id} order by r_time desc")
    public ArrayList<ReplyShowDto>ShowReplyTime(String topic_id);

    @Select("select * from storey_reply where r_id = #{r_id} order by s_r_likes desc")
    public ArrayList<StoreyReplyShowDto>ShowStoreyReplyLike(String r_id);

    @Select("select * from storey_reply where r_id = #{r_id} order by s_r_time desc")
    public ArrayList<StoreyReplyShowDto>ShowStoreyReplyTime(String r_id);

    @Select("select u_name from bbsusers where user_id = #{user_id}")
    public String FindUserName(String user_id);

    @Select("select head from bbsusers where user_id = #{user_id}")
    public String FindUserHead(String user_id);

    @Select("select r_id from bbsreply where r_id = #{r_id}")
    public String findRid(String r_id);

    @Select("select topic_id from bbstopic where topic_id = #{topic_id}")
    public String findTopicId(String topic_id);

}
